﻿<Page x:Class="vsarFlightPlan.Settings" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:converters="using:vsarFlightPlan.Converters" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:vsarFlightPlan" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <Page.Resources>
        <converters:InvertBoolConverter x:Key="InvertBool" />
        <converters:BooltoVisibilityConverter x:Key="BooltoVisibility" />
        <converters:BooltoVisibilityConverter x:Key="InvertBooltoVisibility" InvertResult="True" />
    </Page.Resources>

    <Grid Background="{StaticResource Background}">
        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition Height="20" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="120" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Button Grid.Row="0" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Command="{Binding GoBack}" Style="{StaticResource NavigationBackButtonNormalStyle}" />
        <TextBlock Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Foreground="{StaticResource PrimaryColourBrush}" Style="{StaticResource HeaderTextBlockStyle}" Text="Flight Plan: Settings" />
        <Grid Grid.Row="2" Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBlock Grid.Row="0" Grid.Column="0" Margin="0,0,0,5" VerticalAlignment="Bottom" Style="{StaticResource SubheaderTextBlockStyle}" Text="account details" />
            <TextBlock Grid.Row="1" Grid.Column="0" Margin="0,0,5,0" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="account name" />
            <TextBox Grid.Row="1" Grid.Column="1" Width="400" Margin="5,5,5,0" VerticalAlignment="Bottom" Text="{Binding Account, Mode=TwoWay}" />
            <TextBlock Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text=".visualstudio.com" />
            <Button Grid.Row="0" Grid.Column="1" Click="LaunchSignupClick">sign up for an account</Button>

            <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="username" />
            <TextBox Grid.Row="2" Grid.Column="1" Width="400" Margin="5,5,5,0" VerticalAlignment="Bottom" Text="{Binding Username, Mode=TwoWay}" />
            <TextBlock Grid.Row="2" Grid.Column="2" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="This is your alternate authentication credentials that you need to setup online." TextWrapping="WrapWholeWords" />

            <TextBlock Grid.Row="3" Grid.Column="0" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="password" />
            <PasswordBox Grid.Row="3" Grid.Column="1" Width="400" Margin="5,5,5,0" VerticalAlignment="Bottom" Password="{Binding Password, Mode=TwoWay}" />

            <CheckBox Grid.Row="4" Grid.Column="1" Margin="2,0,0,0" IsChecked="{Binding StorePassword, Mode=TwoWay}">Store password?</CheckBox>
            <TextBlock Grid.Row="5" Grid.Column="0" Margin="0,0,0,5" VerticalAlignment="Bottom" FontSize="18" Style="{StaticResource SubheaderTextBlockStyle}" Text="data source" />
            <TextBlock Grid.Row="6" Grid.Column="0" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="project" />
            <ComboBox Grid.Row="6" Grid.Column="1" Margin="5,5,5,0" VerticalAlignment="Bottom" FontSize="18" IsEnabled="{Binding LoadingProjects, Converter={StaticResource InvertBool}}" ItemsSource="{Binding Projects}" SelectedItem="{Binding SelectedProject, Mode=TwoWay}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Title}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <ProgressBar Grid.Row="6" Grid.Column="1" Height="18" Margin="10" Foreground="#FF5692F9" IsEnabled="True" IsIndeterminate="True" Visibility="{Binding LoadingProjects, Converter={StaticResource BooltoVisibility}}" />
            <Button Grid.Row="6" Grid.Column="2" Width="180" Margin="0,5,0,0" VerticalAlignment="Bottom" HorizontalContentAlignment="Left" Command="{Binding RefreshProjects}" FontWeight="Normal">
                <TextBlock>
                    <Span FontFamily="Segoe UI Symbol"></Span>
                    refresh project list
                </TextBlock>
            </Button>

            <TextBlock Grid.Row="7" Grid.Column="0" VerticalAlignment="Bottom" FontSize="18" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="query" />
            <ComboBox Grid.Row="7" Grid.Column="1" Margin="5,5,5,0" IsEnabled="{Binding LoadingQueries, Converter={StaticResource InvertBool}}" ItemsSource="{Binding Queries}" SelectedItem="{Binding SelectedQuery, Mode=TwoWay}">
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding DisplayName}" />
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <ProgressBar Grid.Row="7" Grid.Column="1" Height="18" Margin="10" Foreground="#FF5692F9" IsEnabled="True" IsIndeterminate="True" Visibility="{Binding LoadingQueries, Converter={StaticResource BooltoVisibility}}" />
            <Button Grid.Row="7" Grid.Column="2" Width="180" Margin="0,5,0,0" VerticalAlignment="Bottom" HorizontalContentAlignment="Left" Command="{Binding RefreshQueries}" FontWeight="Normal">
                <TextBlock>
                    <Span FontFamily="Segoe UI Symbol"></Span>
                    refresh query list
                </TextBlock>
            </Button>
            <Button Grid.Row="8" Grid.ColumnSpan="3" Margin="0,5,0,0" Command="{Binding ClearLocalCache}" Content="Clear local cache" />
            <TextBlock Grid.Row="9" Grid.Column="0" Margin="0,0,0,5" VerticalAlignment="Bottom" Style="{StaticResource SubheaderTextBlockStyle}" Text="filtered view" />
            <TextBlock Grid.Row="10" Grid.Column="0" Margin="0,0,10,0" VerticalAlignment="Top" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="show the following states by default" />
            <StackPanel Grid.Row="10" Grid.Column="1" Margin="5,0,5,5">
                <CheckBox Content="Idea" IsChecked="{Binding ShowByDefaultIdea, Mode=TwoWay}" />
                <CheckBox Content="InFlight" IsChecked="{Binding ShowByDefaultInFlight, Mode=TwoWay}" />
                <CheckBox Content="Landed" IsChecked="{Binding ShowByDefaultLanded, Mode=TwoWay}" />
                <CheckBox Content="Cancelled" IsChecked="{Binding ShowByDefaultCancelled, Mode=TwoWay}" />
                <CheckBox Content="Delayed" IsChecked="{Binding ShowByDefaultDelayed, Mode=TwoWay}" />
            </StackPanel>
            <TextBlock Grid.Row="11" Grid.Column="0" Margin="0,0,10,0" VerticalAlignment="Top" FontWeight="Normal" Style="{StaticResource TitleTextBlockStyle}" Text="max landed projects to show" />
            <StackPanel Grid.Row="11" Grid.Column="1" Margin="5,0,5,5">
                <CheckBox Content="filter by count?" IsChecked="{Binding FilterLandedProjectsByCount, Mode=TwoWay}" />
                <StackPanel Orientation="Horizontal" Visibility="{Binding FilterLandedProjectsByCount, Converter={StaticResource BooltoVisibility}}">
                    <TextBox Width="40" HorizontalContentAlignment="Center" Text="{Binding TotalLandedProjectsToShow, Mode=TwoWay}" />
                    <TextBlock Margin="10,10,0,0" Text="total landed projects to show" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Visibility="{Binding FilterLandedProjectsByCount, Converter={StaticResource InvertBooltoVisibility}}">
                    <TextBox Width="39" HorizontalContentAlignment="Center" Text="{Binding TotalDaysOfLandedProjectsToShow, Mode=TwoWay}" />
                    <TextBlock Margin="10,10,0,0" Text="days of landed projects to show" />
                </StackPanel>
            </StackPanel>
        </Grid>
    </Grid>
</Page>